//
//  SmallCollectionViewCell.m
//  212--Homework  QQy音乐  阿里星球
//
//  Created by 冀永金 on 16/8/13.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "SmallCollectionViewCell.h"
#import "ThirdModel.h"
#import "UIImageView+WebCache.h"
@interface SmallCollectionViewCell ()
@property (nonatomic, strong) UIImageView *image;
@property (nonatomic, strong) UILabel *nameLabel;
@end
@implementation SmallCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.image = [[UIImageView alloc]init];
        [self.contentView addSubview:_image];
        //_image.backgroundColor = [UIColor yellowColor];
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.textAlignment = 1;
        [self.contentView addSubview:_nameLabel];
        self.nameLabel.textColor = [UIColor whiteColor];
        
        //_nameLabel.backgroundColor = [UIColor blueColor];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.image.frame = CGRectMake(self.bounds.size.width / 2 - 20, 20, 40, 40);
    self.image.layer.cornerRadius = 20;
    self.image.clipsToBounds = YES;
    self.nameLabel.frame = CGRectMake(self.bounds.size.width / 2 - 35, 70, 70, 25);
    
    //self.image.center.y : self.center =
}
- (void)setThird:(ThirdModel *)third {
    _third = third;
    self.nameLabel.text = third.name;
    [self.image sd_setImageWithURL:[NSURL URLWithString:third.picUrl] placeholderImage:[UIImage imageNamed:@"dongting"]];
}
@end
